import 'dart:ui';

import 'package:flutter/material.dart';
import 'res/listData.dart';

class WrapLayout extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text("有点f麻烦"),
        ),
        body: LayoutDemo(),
      ),
    );
  }
}

class LayoutDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      height: 600,
      width: 400,
      color: Colors.blue,
      padding: EdgeInsets.all(10),
      child: Wrap(
        spacing: 10,
        runSpacing: 10,
        // direction: Axis.horizontal,
        runAlignment: WrapAlignment.center,
        children: <Widget>[
          MyButton("按钮"),
          MyButton("按钮"),
          MyButton("按钮"),
          MyButton("按钮按钮按钮按钮"),
          MyButton("按钮"),
          MyButton("按钮"),
          MyButton("按钮按钮"),
          MyButton("按钮"),
          MyButton("按钮按钮按钮按钮"),
          MyButton("按钮"),
          MyButton("按钮按钮"),
          MyButton("按钮按钮按钮"),
          MyButton("按钮"),
          MyButton("按钮按钮"),
          MyButton("按钮按钮按钮按钮"),
          MyButton("按钮")
        ],
      ),
    );
  }
}

class MyButton extends StatelessWidget {
  final String text;

  const MyButton(this.text);
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return RaisedButton(
      child: Text(this.text),
      textColor: Theme.of(context).accentColor,
      onPressed: () {},
    );
  }
}
